﻿/*
	Function: OpenWin
	Purpose: Open new windows
*/
function OpenWin(strURL, strWinName, intWidth, intHeight, intLeft, intTop){
	myWindow = window.open(strURL, strWinName, "width=" + intWidth + ",height=" + intHeight + ",left=" + intLeft+ ",top=" + intTop+ ",menubar=no,resizable=yes,scrollbars=yes");
	myWindow.focus();
}

/*
	Function: CloseWin
	Purpose: Close windows
*/
function CloseWin(){
	window.open('','_parent','');
	window.close();
}
function closeTab(){
    window.open('', '_self', '');
    window.close();
}


function OpenWinCenter(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;
    newWindow = window.open(windowUri, windowName, 'resizable=yes,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight + ",menubar=no,resizable=yes,scrollbars=yes");

    newWindow.focus();
    return newWindow.name;
}
function OpenWinCenter2(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=no,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight + ",menubar=no,resizable=no,scrollbars=no");

    newWindow.focus();
    return newWindow.name;
}
function OpenWinCenterClose(windowHeight, windowWidth, windowName, windowUri)
{
	window.close();
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=yes,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight  + ",menubar=no,resizable=yes,scrollbars=yes");

    newWindow.focus();
    return newWindow.name;
}



function ResetForm() {
    window.opener.document.location.reload();
    window.closed();
}

function ResetFormParentNoClose(fromName) {
    window.opener.document.forms[fromName].target = window.opener;
    window.opener.document.forms[fromName].submit();
}
function ResetFormParent(fromName) {
    window.opener.document.forms[fromName].target = window.opener;
    window.opener.document.forms[fromName].submit();
    window.close();
}